﻿<?php
if (!defined('WEB_ROOT')) {
	exit; 
}

// make sure a product id exists
if (isset($_GET['newsId']) && $_GET['newsId'] > 0) {
	$newsId = $_GET['newsId'];
} else {
	// redirect to index.php if product id is not present
	header('Location: index.php');
}

$sql = "SELECT cd.Chude, Ten, Noidung, Tieude, Tacgia, Image
        FROM tbl_tintuc tt, tbl_chude cd
		WHERE tt.Tintuc_id = $newsId AND tt.Chude_id = cd.Chude_id";
$result = mysql_query($sql) or die('Cannot get news. ' . mysql_error());

$row = mysql_fetch_assoc($result);
extract($row);

if ($Image) {
	$Image = WEB_ROOT . 'images/tintuc/' . $Image;
} else {
	$Image = WEB_ROOT . 'images/no-image-large.png';
}


?>
<p>&nbsp;</p>
<form action="processNews.php?action=addNews" method="post" enctype="multipart/form-data" name="frmAddProduct" id="frmAddProduct">
 <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
  <tr> 
   <td width="150" class="label">Chủ đề</td>
   <td class="content"><?php echo $Chude; ?></td>
  </tr>
  <tr> 
   <td width="150" class="label">Tên bản tin</td>
   <td class="content"><?php echo $Ten; ?> </td>
  </tr>
  <tr> 
   <td width="150" class="label">Hình ảnh</td>
   <td class="content"><img src="<?php echo $Image; ?>"></td>
  </tr>
  <tr> 
   <td width="150" class="label">Tiêu đề</td>
   <td class="content"> <?php echo $Tieude; ?></td>
  </tr>
  <tr> 
   <td width="150" class="label">Nội dung</td>
   <td class="content"><?php echo nl2br($Noidung); ?> </td>
  </tr>
  <tr> 
   <td width="150" height="36" class="label">Tác giả</td>
   <td class="content"><?php echo $Tacgia; ?> </td>
  </tr>
 </table>
 <p align="center"> 
  <input name="btnModifyProduct" type="button" id="btnModifyProduct" value="Cỉnh sửa tin tức" onClick="window.location.href='index.php?view=modify&newsId=<?php echo $newsId; ?>';" class="box">
  &nbsp;&nbsp;
  <input name="btnBack" type="button" id="btnBack" value=" Trở về " onClick="window.history.back();" class="box">
 </p>
</form>
